<?php

    /**
     * Gets a translation
     *
     * @param       Dwoo         $dwoo
     * @param       string       $key : the locale key
     * @throws      Core_ArgumentException
     * @return      string
     */
    function Dwoo_Plugin_error(Dwoo $dwoo, $key)
    {
        $key = 'base~form_errors_'. $key;

        $params = func_get_args();

        switch (count($params)) {
            case 2:
                return __($key);
            break;

            case 3:
                return __($key, $params[2]);
            break;

            case 4:
                return __($key, $params[2], $params[3]);
            break;

            default:
                throw new Core_ArgumentException('Invalid argument number in function "locale" ('. count($params) .' arguments found, expected 1, 2 or 3)');
        }
    }